package com.example.tests;

import com.example.utils.ListOf;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

/**
 * Created with IntelliJ IDEA.
 * User: pshevchenko
 * Date: 19.03.13
 * Time: 12:35
 * To change this template use File | Settings | File Templates.
 */
public class PrintPhoneTestSet extends TestBase {

    @Test
    public void testPhoneList(){
        ListOf<PhoneData> phoneListInGrid = applicationManager.getModel().getPhoneList();

        applicationManager.navigateTo()
                .printPhonePage();

        ListOf<PhoneData> phoneListOnPrintForm = applicationManager.getPrintPhoneHelper().getPhoneList();

        applicationManager.navigateTo()
                .reloadApp();

        assertThat(phoneListInGrid, equalTo(phoneListOnPrintForm));

    }

    @Test
    public void testPhoneListFormat(){
        applicationManager.navigateTo()
                .printPhonePage();

        int wrongAddressCount = applicationManager.getPrintPhoneHelper().checkWrongAddressCount();

        applicationManager.navigateTo()
                .reloadApp();

        assertThat(wrongAddressCount, equalTo(0));

    }

}
